From d5c74846424da343a8f1d028065e88b72f1d52d2 Mon Sep 17 00:00:00 2001 From: robertlipe Date: Sat, 20 Jul 2013 02:41:38 +0000 Subject: [PATCH] Get rid of explicit usec refs in destinator, waypt, and unicsv. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4462 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/destinator.cc | 2 -- gpsbabel/unicsv.cc | 12 ++++++------ gpsbabel/waypt.cc | 3 ++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/gpsbabel/destinator.cc b/gpsbabel/destinator.cc index d35ac0c1a..67c0c0e9e 100644 --- a/gpsbabel/destinator.cc +++ b/gpsbabel/destinator.cc @@ -334,8 +334,6 @@ destinator_read_trk(void) strptime(buff, "%d%m%y%H%M%S", &tm); int millisecs = (int) time % 1000; wpt->SetCreationTime(mkgmtime(&tm), millisecs); -// FIXME: this is papering over a problem somewhere... -wpt->microseconds = millisecs * 1000; if (wpt->fix > 0) { wpt->fix = (fix_type)(wpt->fix + 1); diff --git a/gpsbabel/unicsv.cc b/gpsbabel/unicsv.cc index f1d8c0e14..fbc71311f 100644 --- a/gpsbabel/unicsv.cc +++ b/gpsbabel/unicsv.cc @@ -1761,15 +1761,15 @@ unicsv_waypt_disp_cb(const waypoint *wpt) } snprintf(buf, sizeof(buf), "%02d:%02d:%02d", tm.tm_hour, tm.tm_min, tm.tm_sec); - if (wpt->microseconds > 0) { - int len = 6; - int ms = wpt->microseconds; + int millisecs = wpt->GetCreationTime().msec(); + if (millisecs > 0) { + int len = 3; - while (len && (ms % 10 == 0)) { - ms /= 10; + while (len && (millisecs % 10 == 0)) { + millisecs /= 10; len--; } - snprintf(msec, sizeof(msec), ".%0*d", len, ms); + snprintf(msec, sizeof(msec), ".%0*d", len, millisecs); strcat(buf, msec); } gbfprintf(fout, "%s%s", unicsv_fieldsep, buf); diff --git a/gpsbabel/waypt.cc b/gpsbabel/waypt.cc index dbb7ea686..eb35939c9 100644 --- a/gpsbabel/waypt.cc +++ b/gpsbabel/waypt.cc @@ -538,7 +538,8 @@ waypt_time(const waypoint *wpt) if (wpt->creation_time <= 0) { return (double) 0; } else { - return ((double)wpt->creation_time + ((double)wpt->microseconds / 1000000)); + + return ((double)wpt->creation_time + ((double)wpt->creation_time.msec() / 1000)); } } -- 2.30.2